﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Component
{
    public class Sessions
    {
        /// <summary>
        ///     public static string IdProducts
        /// </summary>
        public static string MessageResult
        {
            get
            {
                if (ManagementSession.ContainsInSession(ConstString._SessionResult))
                    return ConvertType.ToString(ManagementSession.GetSession(ConstString._SessionResult));
                return "";
            }
            set
            {
                ManagementSession.SetSession(ConstString._SessionResult, value);
            }
        }
        /// <summary>
        ///   public static Users CurrentUser
        /// </summary>
        public static Users CurrentUser
        {
            get
            {
                if (ManagementSession.ContainsInSession(ConstString._SessionUserInfo))
                    return ManagementSession.GetSession(ConstString._SessionUserInfo) as Users;
                return null;
            }
            set { 
                ManagementSession.SetSession(ConstString._SessionUserInfo,value); }
        }
        /// <summary>
        /// list id product in cart
        /// </summary>
        public static string IdProducts
        {
            get
            {
                if (ManagementSession.ContainsInSession(ConstString._SessionIdProducts))
                    return ConvertType.ToString(ManagementSession.GetSession(ConstString._SessionIdProducts));
                return "";
            }
            set
            {
                ManagementSession.SetSession(ConstString._SessionIdProducts, value);
            }
        }
        /// <summary>
        /// = true if language = vn
        /// </summary>
        public static bool LanguageVN
        {
            get
            {
                return ConvertType.ToBool(ManagementSession.GetSession(ConstString._SessionLanguage));
            }
            set
            {
                ManagementSession.SetSession(ConstString._SessionLanguage, value);
            }
        }
        /// <summary>
        /// 
        /// </summary>
        public static string UrlFrontend
        {
            get
            {
                if (ManagementSession.ContainsInSession(ConstString._SessionUrlFrontend))
                    return ConvertType.ToString(ManagementSession.GetSession(ConstString._SessionUrlFrontend));
                return "";
            }
            set
            {
                ManagementSession.SetSession(ConstString._SessionUrlFrontend, value);
            }
        }
       
        public static string UrlAdmin
        {
            get
            {
                if (ManagementSession.ContainsInSession(ConstString._SessionUrlAdmin))
                    return ConvertType.ToString(ManagementSession.GetSession(ConstString._SessionUrlAdmin));
                return "";
            }
            set
            {
                ManagementSession.SetSession(ConstString._SessionUrlAdmin, value);
            }
        }

        public static string CatSub
        {
            get
            {
                if (ManagementSession.ContainsInSession(ConstString._CatSub))
                    return ConvertType.ToString(ManagementSession.GetSession(ConstString._CatSub));
                return "";
            }
            set
            {
                ManagementSession.SetSession(ConstString._CatSub, value);
            }
        }
        public static string Cat
        {
            get
            {
                if (ManagementSession.ContainsInSession(ConstString._Cat))
                    return ConvertType.ToString(ManagementSession.GetSession(ConstString._Cat));
                return "";
            }
            set
            {
                ManagementSession.SetSession(ConstString._Cat, value);
            }
        }
        public static string Add
        {
            get
            {
                if (ManagementSession.ContainsInSession(ConstString._SSnAdd))
                    return ConvertType.ToString(ManagementSession.GetSession(ConstString._SSnAdd));
                return "";
            }
            set
            {
                ManagementSession.SetSession(ConstString._SSnAdd, value);
            }
        }
    }
}
